/**
 * Copyright (c) 2012, http://www.yissugames.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.yissugames.blocklife;

import java.util.ArrayList;
import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;

import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;

import java.awt.Font;
import java.util.HashMap;

import org.lwjgl.input.Keyboard;
import org.newdawn.slick.Color;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.opengl.Texture;

import com.yissugames.blocklife.gamelogic.Block;
import com.yissugames.blocklife.gamelogic.BlockCamera;
import com.yissugames.blocklife.gamelogic.World;
import com.yissugames.blocklife.generators.BiomGenerator;
import com.yissugames.blocklife.generators.BiomPlains;
import com.yissugames.gui.AnimatedImage;
import com.yissugames.gui.Button;
import com.yissugames.gui.CheckBox;
import com.yissugames.gui.ComboBox;
import com.yissugames.gui.ComboBoxItem;
import com.yissugames.gui.Event;
import com.yissugames.gui.GUI;
import com.yissugames.gui.Slider;

public class TestScreen implements Screen {

	World world;
	BlockCamera camera;
	
	@Override
	public void render() {
		if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
			ScreenSystem.set(new MainMenuScreen());
		
		camera.update();
		
		world.render(false);
	}

	@Override
	public boolean init() {
		
		Block.LoadBlocks();
		camera = new BlockCamera();
		
		world = new World("3000");
		
		BlockLife.BackgroundR = 0;
		BlockLife.BackgroundG = 0;
		BlockLife.BackgroundB = 0;
		
		return true;
	}
	
	public static int randomRange(Random random, int low, int high) {
		return random.nextInt(high - low) + low;
	}

	@Override
	public boolean quit() {
		BlockLife.BackgroundR = 1;
		BlockLife.BackgroundG = 1;
		BlockLife.BackgroundB = 1;
		
		return true;
	}

	

}
